-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: refactor system prompt sections from markdown to XML format #7427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Replace markdown separators (====) with XML <section> tags - Update all section files to use <section name='SECTION_NAME'> format - Convert tool descriptions from ## toolname to <tool name='toolname'> format - Maintain backward compatibility with existing functionality - Improve semantic structure for better parsing and validation This change provides clearer semantic boundaries between different types of content and makes the prompt structure easier to programmatically parse and manipulate.
- Update test expectations from markdown format (## toolname) to XML format (<tool name='toolname'>) - Update snapshots to reflect new XML-based section and tool structures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in a mirror - everything looks backward but the bugs are still mine.
| IMPORTANT NOTE: This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool. | ||
| return `<tool name="attempt_completion"> | ||
| <description>After each tool use, the user will respond with the result of that tool use, i.e. if it succeeded or failed, along with any reasons for failure. Once you've received the results of tool uses and can confirm that the task is complete, use this tool to present the result of your work to the user. The user may respond with feedback if they are not satisfied with the result, which you can use to make improvements and try again.</description> | ||
| <important>This tool CANNOT be used until you've confirmed from the user that any previous tool uses were successful. Failure to do so will result in code corruption and system failure. Before using this tool, you must ask yourself in <thinking></thinking> tags if you've confirmed from the user that any previous tool uses were successful. If not, then DO NOT use this tool.</important> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? I notice this tool uses an <important> tag for critical notes while other tools embed important information directly in the <description> tag. Could we consider standardizing this approach across all tools for consistency?
For example, other tools include warnings like "IMPORTANT: You can read a maximum of 5 files..." directly in the description, but here we have a separate <important> tag.
| Description: Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action. | ||
| return `<tool name="browser_action"> | ||
| <description>Request to interact with a Puppeteer-controlled browser. Every action, except \`close\`, will be responded to with a screenshot of the browser's current state, along with any new console logs. You may only perform one browser action per message, and wait for the user's response including a screenshot and logs to determine the next action.</description> | ||
| <important> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my comment on attempt-completion.ts - this tool uses both <description> and <important> tags, creating a mixed content structure. While this provides good separation of concerns, it differs from the pattern used in most other tools.
Could we consider either:
- Moving all tools to use the
<important>tag pattern for consistency, or - Embedding the important notes in the description like other tools do?
Summary
This PR addresses Issue #7424 by refactoring the system prompt sections from markdown format to XML format, providing clearer semantic boundaries and better programmatic parsing capabilities.
Changes
Section Format Updates
====) with XML<section name="SECTION_NAME">tagstool-use.ts: Now uses<section name="TOOL USE">modes.ts: Now uses<section name="MODES">capabilities.ts: Now uses<section name="CAPABILITIES">rules.ts: Now uses<section name="RULES">system-info.ts: Now uses<section name="SYSTEM INFORMATION">objective.ts: Now uses<section name="OBJECTIVE">markdown-formatting.ts: Now uses<section name="MARKDOWN RULES">mcp-servers.ts: Now uses<section name="MCP SERVERS">Tool Description Format Updates
## toolname) to XML format (<tool name="toolname">)Test Updates
Benefits
Testing
Important Note
As mentioned in the issue, the tool call functionality (which uses XML tags like
<tool_name>) was NOT touched - only the system prompt structure was refactored.Fixes #7424
Important
Refactor system prompt sections and tool descriptions from markdown to XML format for improved semantic clarity and parsing, updating test snapshots accordingly.
system-prompt.spec.tsto reflect XML structure.read_file,write_to_file,execute_command, etc.This description was created by
for 8d869dc. You can customize this summary. It will automatically update as commits are pushed.